package com.cmcc.waf.report.core.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义业务异常
 * @author kaysen
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = 3444246600784945346L;
    private int code;
    private String msg;

    public BusinessException(int code) {
        this.code = code;
    }

    public BusinessException(int code, String... params) {
        this.code = code;
    }

    public BusinessException(int code, Throwable e) {
        super(e);
        this.code = code;
    }

    public BusinessException(int code, Throwable e, String... params) {
        super(e);
        this.code = code;
    }

    public BusinessException(String msg) {
        super(msg);
        this.code = ErrorCode.INTERNAL_SERVER_ERROR;
        this.msg = msg;
    }

    public BusinessException(String msg, Throwable e) {
        super(msg, e);
        this.code = ErrorCode.INTERNAL_SERVER_ERROR;
        this.msg = msg;
    }

}
